﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Reflection;
using System.Xml;
using EraNet.Framework;
using EraNet.Framework.Mvc;
using EraNet.Core;
using EraNet.Core.Data;
using EraNet.Core.Model;
using EraNet.Core.Infrastructure;
using EraNet.Services;

namespace EraNet.WebApp
{
    public class RegisterController : HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        protected void Application_Start()
        {
            EngineContext.Initialize(false);
            //set dependency resolver
            var dependencyResolver = new EraDependencyResolver();
            DependencyResolver.SetResolver(dependencyResolver);

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            //RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);


            EraNet.WebApp.AreaRegistrationOrder.RegisterAllAreasOrder();
            // string css = "defaults";
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{file}.html");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        }

    }
}
